package com.gupao.javavip.rpc.server;

import com.gupao.javavip.rpc.framework.server.RPCServer;
import com.gupao.javavip.rpc.framework.server.RPCServerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = "com.gupao.javavip.rpc.**")
public class SpringConfig {
    @Bean
    public RPCServer getRPCServer() {
        return new RPCServer();
    }

    @Bean(name = "rpcConfig")
    public RPCServerConfig getRPCConfig() {
        RPCServerConfig serverConfig = new RPCServerConfig();
        serverConfig.setPort(8081);
        serverConfig.setRegistryAdd("192.168.56.101:2181");
        serverConfig.setServiceId("UserServiceServer");
        return serverConfig;
    }
}
